<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Control.php');
require_once($Config->WebCMSRoot.'Views/Media.php');
require_once($Config->WebCMSRoot.'Models/Media.php');

Class Media extends BaseControl
{
	var $media;
	var $view;

	function Media($parameters, &$page)
	{
		$this->media = new MediaModel();
		$this->view  = new MediaView();
		
		parent::BaseControl($parameters, &$page);
	}

	function Execute()
	{
		switch ($this->GetParameter('show'))
		{
			case 'list':
				$this->media->Retrieve(&$this->parameters);
				$this->view->PrintList(&$this->media);
				break;
			case 'media':
				if (is_numeric($this->GetParameter('id')))
				{
					$this->media->Retrieve(&$this->parameters);
					$this->view->Show(&$this->media->Collection[0]);
				}
				break;
		}

		parent::Execute();
	}

	function ValidateArguments($args)
	{
	  $valid = (count($args) == 2);

		return $valid;
	}
}
?>